//aboutme.js
//获取应用实例
var app = getApp()
var util = require('../../utils/util.js');
Page({
  data: {
     toastHidden:true,
     urlfile: "https://jgj.hzlingdian.com/coreAttachment/image/get/",
     imgid: "1802092356549OGi",
     info: {}
  },
  onLoad: function (options) {
    var key = 'info_' + options.id
    var info = wx.getStorageSync(key)
    if (info) {
      console.log('data from localCache')
      this.setData({ info: info })
      return true
    }
    var obj = this;
    var data = { 
      crcpnUuid: options.id
    };
    util.requestGet("coreCoupon/views", data, function (res){
      obj.setData({ info: res.data })
      console.log(key)
      wx.setStorageSync(key, res.data)
      console.log('data from server')
    },function(errData){
      console.log('server error')
      obj.setData({ toastHidden: false, msg: '当前网格异常，请稍后再试' })
    });
  },
  closepage: function(){
      wx.navigateBack()
  },
  toastChange: function(){
    obj.setData({toastHidden:true})
    wx.navigateBack()
  },  
})